<?php
//2011-12-08
require( "../classes/mofachi.User.php" );
$user = new User();
@ $user->email = $_POST[ "email" ];
@ $user->password = $_POST[ "password" ];

header( 'Content-Type: text/plain; charset=utf-8' );
if( !$user->email || !$user->password ){
	echo utf8_encode( "{\"reply\":-1,\"msg\":\"ERROR: No email or password provided\"}" );
	exit();
}
$user->loadByEmail();
if( $user->isLoaded() ) {
	echo utf8_encode( "{\"reply\":0,\"msg\":\"ERROR: The email has been used\"}" );
	exit();
}
if( $user->add() ) {
	echo utf8_encode( "{\"reply\":".$user->user_id.",\"msg\":\"Success: The user account has been added!\"}" );
}
?>